<script lang="tsx">
import { Component, Prop, Vue } from 'vue-property-decorator';
@Component({
  name: 'OptionContent'
})
export default class OptionContent extends Vue {
  @Prop() private option?: any

  private render (h: any) {
    const getParent: any = (vm: any) => {
      if (vm.componentName === 'V7TransferPanel') {
        return vm;
      } else if (vm.$parent) {
        return getParent(vm.$parent);
      } else {
        return vm;
      }
    };
    const panel = getParent(this);
    const transfer = panel.$parent || panel;
    return panel.renderContent
      ? panel.renderContent(h, this.option)
      : transfer.$scopedSlots.default
        ? transfer.$scopedSlots.default({ option: this.option })
        : <span>{ this.option[panel.labelProp] || this.option[panel.keyProp] }</span>;
  }
}
</script>
